import React, { Component } from 'react'
import { Route, Switch } from 'react-router-dom'

import Add from './Add'
import List from './List'

import SlideBar from '../components/SlideBar'


export class User extends Component {
    state = {
        slideBarData: [
            {path: '/user/add', content: '用户添加'},
            {path: '/user/list', content: '用户列表'}
        ]
    }
    render() {
        return (
            <>
                <SlideBar slideBarData={this.state.slideBarData}></SlideBar>
                <Switch>
                    {/*二级菜单 默认展示一个页面*/}
                    <Route exact path='/user' component={Add}></Route>
                    <Route exact path='/user/add' component={Add}></Route>
                    <Route exact path='/user/list/:uid' component={List}></Route>
                </Switch>
            </>
        )
    }
}

export default User
